<template>
	<!-- 量化分级-评定管理 -->
	<view class="">
		<!-- 头部 -->
		<lhfj-header currentNav="0" @search="search"></lhfj-header>
		<!-- 评定规范 -->
		<view class="section">
			<view class="section-title-bar">
				<u-section title="评定规范" :right="false" :font-size="sectionFontSize" :bold="sectionBold" :show-line="false"
					:arrow="false"></u-section>
			</view>
			<view class="list-bar">
				<view class="list-item" v-for="(item, index) in pdgfList" :key="index"
					@click="toDetail('pdgf', item.id)">
					<text class="dot">●</text>
					<text class="text common-text">{{item.title}}</text>
				</view>
			</view>
		</view>
		<!-- 评定条件 -->
		<view class="section">
			<view class="section-title-bar">
				<u-section title="评定条件" :right="false" :font-size="sectionFontSize" :bold="sectionBold" :show-line="false"
					:arrow="false"></u-section>
			</view>
			<view class="imglist-bar">
				<view class="imglist-item" v-for="(item, index) in pdtjList" :key="index"
					@click="toDetail('pdtj', item.id)">
					<image class="thumb" :src="item.images" mode=""></image>
					<view class="text-bar">
						<text class="text">{{item.content}}</text>
					</view>
				</view>
			</view>
		</view>
		<!-- 评定等级说明 -->
		<view class="section">
			<view class="section-title-bar">
				<u-section title="评定等级说明" :right="false" :font-size="sectionFontSize" :bold="sectionBold" :show-line="false"
					:arrow="false"></u-section>
			</view>
			<view class="single-bar">
				<view class="single-item">
					<image :src="pdsmUrl" mode="aspectFit"></image>
				</view>
			</view>
		</view>
		<!-- 星级评定项目 -->
		<view class="section">
			<view class="section-title-bar">
				<u-section title="星级评定项目" :right="false" :font-size="sectionFontSize" :bold="sectionBold" :show-line="false"
					:arrow="false"></u-section>
			</view>
			<view class="single-bar">
				<view class="single-item">
					<image :src="pdxmUrl" mode="aspectFit"></image>
				</view>
			</view>
		</view>
		<!-- 星级评定流程 -->
		<view class="section">
			<view class="section-title-bar">
				<u-section title="星级评定流程" :right="false" :font-size="sectionFontSize" :bold="sectionBold" :show-line="false"
					:arrow="false"></u-section>
			</view>
			<view class="single-bar">
				<view class="single-item">
					<image :src="pdlcUrl" mode="aspectFit"></image>
				</view>
			</view>
		</view>
		<!-- 底部 -->
		<lhfj-footer></lhfj-footer>
	</view>
</template>

<script>
	import config from "@/app.config.js";
	import DEMO_PDGF from "@/data/demoPdgf.js";
	import DEMO_PDTJ from "@/data/demoPdtj.js";

	export default {
		data() {
			return {
				keyword: '',
				
				pdgfList: [], // 评定规范
				pdtjList: [], // 评定条件
				pdsmUrl: '', // 评定等级说明 图片地址
				pdxmUrl: '', // 星级评定项目 图片地址
				pdlcUrl: '', // 星级评定流程 图片地址
				
				sectionFontSize: this.$css.sectionFontSize,
				sectionBold: this.$css.sectionBold,
			}
		},
		onLoad(options = {}) {
			this.initPage(options);
		},
		methods: {
			initPage(options) {
				this.getPdgfList();
				this.getPdtjList();
				this.getImages();
			},
			pageTo(path) {
				vk.navigateTo(path);
			},
			search(data){
				this.keyword = data.keyword;
				vk.toast('搜索关键字 = ' + this.keyword);
			},
			toDetail(nav, id){
				let path, obj;
				if(nav == 'pdgf'){
					path = '/pages/common/single';
					obj = this.pdgfList.find(item => item.id == id);
				}else if(nav == 'pdtj'){
					path = '/pages/common/single';
					obj = this.pdtjList.find(item => item.id == id);
				} else{
					vk.toast(`点击了${nav}【${id}】` + ' XXXX 未开发');
					return;
				}
				this.$tools.pageTo(path, obj);
			},
			// 读取评定规范列表
			getPdgfList() {
				this.pdgfList = DEMO_PDGF.filter(item => item.content.indexOf(this.keyword) >= 0);
			},
			// 读取评定条件列表
			getPdtjList() {
				this.pdtjList = DEMO_PDTJ.filter(item => item.content.indexOf(this.keyword) >= 0);
			},
			getImages(){
				this.pdsmUrl = 'https://mp-adf91af7-51bf-4e2e-abae-1ed51120ab92.cdn.bspapp.com/demo/sanwt/demoimages/pdgl/pdsm.png'; // 评定等级说明 图片地址
				this.pdxmUrl = 'https://mp-adf91af7-51bf-4e2e-abae-1ed51120ab92.cdn.bspapp.com/demo/sanwt/demoimages/pdgl/pdxm.png'; // 星级评定项目 图片地址
				this.pdlcUrl = 'https://mp-adf91af7-51bf-4e2e-abae-1ed51120ab92.cdn.bspapp.com/demo/sanwt/demoimages/pdgl/pdlc.png'; // 星级评定流程 图片地址
			}
		},
		// 监听器
		watch: {

		},
		// 计算属性
		computed: {

		},
		// 监听 - 页面下拉刷新
		onPullDownRefresh() {
			setTimeout(() => {
				this.initPage();
				uni.stopPullDownRefresh();
			}, 1000);
		},
	}
</script>

<style lang="scss">
	.list-bar{
		margin: auto;
		width: 90%;
	}
	.list-item{
		font-size: 14px;
		color: #43618B;
	}
	.list-item .dot{
		padding: 0 20rpx;
	}
	.list-item .text{
		
	}
	
	.imglist-bar{
		margin: auto;
		width: 90%;
	}
	.imglist-item .thumb{
		margin-left: 40rpx;
	}
	.imglist-item .text-bar{
		padding: 0px 40rpx 0px 30rpx;
		background-color: #F0F0F0;
		font-size: 12px;
		.text{
			line-height: 16px;
		}
	}
	.single-bar .single-item{
		margin: auto;
		width: 90%;
		text-align: center;
	}
	.single-bar .single-item image{
		margin: auto;
	}
</style>